﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Business;
using Common;

namespace WinUI.SearchFrm
{
    public partial class ChannelFrm : Form
    {
        private Frm_MasterPlan.Frm_CreateMasterPlan parentForm;

        public ChannelFrm(List<ComboItem> listChannel, Frm_MasterPlan.Frm_CreateMasterPlan _parentForm)
        {
            InitializeComponent();

            Init(listChannel, _parentForm);
        }

        private void Init(List<ComboItem> listChannel, Frm_MasterPlan.Frm_CreateMasterPlan _parentForm)
        {
            this.parentForm = _parentForm;

            clb_Channel.DataSource = listChannel;
        }

        private void bt_OK_Click(object sender, EventArgs e)
        {
            if ((clb_Channel.CheckedItems.Count) != 0)
            {
                DialogResult dr = MessageBox.Show(Common.MESSAGE_STRING.CONFIRM_SELECT, Common.MESSAGE_TITLE.CONFIRM, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (dr == System.Windows.Forms.DialogResult.Yes)
                {
                    List<Business.Region> data = new List<Business.Region>();
                    //data.AddRange(clb_Middle.CheckedItems.Cast<Business.Region>().ToList());

                    //parentForm.ShowCheckedRegions(data);

                    this.Close();
                }
            }
            else
            {
                MessageBox.Show(Common.MESSAGE_STRING.NULLCHECKEDCHANNEL_ERROR, Common.MESSAGE_TITLE.ERROR);
            }
        }
    }
}
